import { defineStore } from 'pinia'
import { ref } from 'vue'

//定义初始值
const initAccount = {
  name: '小杨同学',
  email: '11@qq.com',
  avatar: '',
}
export const useAccountStore = defineStore('account', () => {
  //1、定义数值
  const account = ref({ ...initAccount })
  //2、函数/动作
  // 修改
  function update(params: never) {
    Object.assign(account.value, params)
  }
  // 清除
  function clear() {
    account.value = { ...initAccount }
  }
  return { account, update, clear }
})
